package models

import beans.Record
import com.jfinal.plugin.activerecord.Model

class BoughtM: Model<BoughtM>() {
    companion object {
        val AGENT by lazy {
            BoughtM()
        }
        const val TABLE_NAME = "bought"
        const val ID = "id"
        const val RECORD_ID = "record_id"
        const val USER_ID = "user_id"

        fun findBoughtByUserId(userId: Int): List<BoughtM>{
            return AGENT.find("select * from $TABLE_NAME where $USER_ID = ?", userId)
        }
    }
}